/*
 * 头递归　尾递归(循环)
 * */
#include <stdio.h>
int fanctorial(int n);
int main(int argc, const char *argv[])
{
	int n = 0;
	while(~(scanf("%d", &n))){
		if(n == 0) break;
		printf("%d! = %d\n",n,fanctorial(n));
	}
	return 0;
}
int fanctorial(int n)
{
	if(n == 1) return 1;
	return n * fanctorial(n-1);
}
